package com.cqjtu.store.address.mapper;

import com.cqjtu.store.address.pojo.entity.Address;
import com.cqjtu.store.address.pojo.entity.District;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Repository
public interface AddressMapper {
    /**
     * 根据用户编号去查询该用户的地址列表
     */
    List<Address> getList(Integer userId);

    /**
     * 根据编号查询地址
     * @param id
     * @return
     */
    Address getById(Integer id);

    int delete(Integer id);

    /**
     * 设置地址为非默认
     * @param id
     * @return
     */
    int setNunDefault(Integer id);

    int setDefault(Address address);

    List<District> getDistrictList(Integer parent);

    int count(Integer userId);

    int save(Address address);

    int update(Address address);

    /**
     * 根据行政地址的code查询地址
     */
    District getDistrictByCode(Integer code);
}
